# 字典是无序的
dict = {"name": "小明",
        "age": 18,
        "gender": True}

print(dict)

# 取值 key不存在会报错
print(dict['name'])
print(dict.get('name'))



# 增加/修改
# 如果key不存在，会新增键值对
dict['weight'] = 60
# 如果key存在，会修改键值对
dict['weight'] = 65


# 删除 key不存在，程序会报错
# dict.pop('name')
dict.popitem()


print(dict.keys())
print(dict.values())
print(dict.items())